// pages/third/third.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    isShow:true,
    address: {
      province: '广东',
      city: '湛江'
    }
  },
  onLoad() {
    // console.log('index---onLoad---', app.globalData)
    // console.log('third---onLoad---')
  },
  onShow() {
    // console.log('third---onShow---')
  },
  onReady() {
    console.log('third---onReady---')
  },
  onHide() {
    console.log('third---onHide---')
  },
  onUnload() {
    console.log('third---onUnload---')
  },
  getValue(e) {
    console.log('---parent---',e.detail)
  },
  getUserInfo(e) {
    console.log('---e---',e)
  },
  wxLogin() {
    wx.getUserProfile({
      desc: '为了更好地为您提供服务',
      success: res => {
        console.log(res)
      },
      fail: err => {
        console.log(err)
      }
    })
  },
  login() {
    wx.login({
      success: (res) => {
        console.log('---res---',res)

        wx.request({
          url: 'https://api.weixin.qq.com/sns/jscode2session',
          data: {
            "appid": "wxffa46fb8f2f7071d",
            "secret": "101bee634e2c9d0958c2485ab826782b",
            "js_code": res.code,
            "grant_type": "authorization_code"
          },
          success: res => {
            console.log('---res---',res)
          }
        })
      },
    })
  }
})